﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PMisuseAn.behaviour.model
{
    [Serializable()]
    public class Agent
    {
        private string agentName_;
        private string clusterName_;
        private Actor actorType_;
        private StateMachine assignedMachine_;
        private int agentID_;
        private string activeGroupName_;
        public List<string> associatedGroups;

        public DateTime timestamp;
        public Agent()
        {
            associatedGroups = new List<string>();
        }

        public int agentID
        {
            get
            {
                return agentID_;
            }
            set
            {
                agentID_ = value;
            }
        }

        public string clusterName
        {
            get
            {
                return clusterName_;
            }
            set
            {
                clusterName_ = value;
            }
        }

        public string agentName
        {
            get
            {
                return agentName_;
            }
            set
            {
                agentName_ = value;
            }
        }

        public Actor actorType
        {
            get
            {
                return actorType_;
            }
            set
            {
                actorType_ = value;
            }
        }

        public StateMachine assignedMachine
        {
            get
            {
                return assignedMachine_;
            }
            set
            {
                assignedMachine_ = value;
            }
        }

        public void addAssociatedGroup(string groupName)
        {
            associatedGroups.Add(groupName);
        }

        public void removeAssociatedGroup(string groupName)
        {
            foreach (string gpn in associatedGroups)
            {
                if (groupName.Equals(gpn))
                {
                    associatedGroups.Remove(gpn);
                    break;
                }
            }
        }

        public string activeGroupName
        {
            get
            {
                return activeGroupName_;
            }
            set
            {
                activeGroupName_ = value;
            }

        }
    }
}
